<div id="mainContent" class="easyui-layout" data-options="fit:true">
<div data-options="region:'north'" style="overflow: hidden;height: 135px;">
        <div class="easyui-panel" data-options="border:0">
        <fieldset style="padding: 10px;margin: 4px; border:1px solid #f0ad4e">
            <legend>查询</legend>
                <input type="hidden" id="dictId" name="dictId"/>
                <div style="margin-bottom:20px;text-align: right">
                    <select id="moduleName" name="moduleName" class="easyui-combobox theme-textbox-radius" label="操作模块:" style="width:25%;" data-options="editable:false">
                        <option value="-1" selected="selected">全部</option>
                        <option value="system">系统配置</option>
                        <option value="wechat">微信配置</option>
                        <option value="shop">团商城</option>
                        <option value="user">用户信息</option>
                    </select>
                    <select id="operateType" name="operateType" class="easyui-combobox theme-textbox-radius" label="操作类型:" style="width:25%;" data-options="editable:false">
                        <option value="-1" selected="selected">全部</option>
                        <option value="add">新增</option>
                        <option value="update">更新</option>
                        <option value="delete">删除</option>
                        <option value="query">查询</option>
                    </select>
                    <input id="content" name="content" class="easyui-textbox theme-textbox-radius" label="内容:" data-options="prompt:'请输入字操作内容'" style="width:48%;"/>
                </div>
                <div style="text-align: right">
                    <input id="startDate" name="startDate"  class="easyui-datebox theme-textbox-radius" label="开始日期:" style="width:26%;" data-options="prompt:'请选择开始日期',editable:false,required:false,formatter:dateFormatter,onSelect:onSelected"/>
                    <input id="endDate" name="endDate"  class="easyui-datebox theme-textbox-radius" label="结束日期:" style="width:26%;" data-options="prompt:'请选择结束日期',editable:false,required:false,formatter:dateFormatter,validType:'equalStartDate[\'#startDate\']'"/>
                    <a id="queryLogBtn" href="#" class="easyui-linkbutton button-orange button-xs l-btn l-btn-small">
                        <span class="l-btn-left">
                            <span class="l-btn-text">
                                <i class="iconfont">&#xe6ac;</i> 查询
                            </span>
                        </span>
                    </a>
                </div>
        </fieldset>
        </div>
    </div>
    <div data-options="region:'center'">
        <table id="adminLogDg" title="" class="easyui-datagrid"
               data-options="
                iconCls: 'icon-log-viewer',
                url: '${base}/admin/log/dataList.do',
                fit:true,
                lines: true,
                rownumbers: true,
                striped: true,
                animate:true,
                singleSelect : true,
                showFooter: true,
                pagination: true,
                idField: 'olId',
                queryParams: {
                    module: '',
                    type: '',
                    content: '',
                    startD: '',
                    endD: ''
                }
            " border="0">
            <thead data-options="frozen:true">
            <tr>
                <th data-options="field:'logId',hidden:true">日志ID</th>
                <th data-options="field:'module'" width="10%">操作模块</th>
                <th data-options="field:'operateType'" width="10%">操作类型</th>
                <th data-options="field:'nickName'" width="10%">操作员</th>
                <th data-options="field:'content'" width="30%">详细内容</th>
                <th data-options="field:'createTime'" width="15%">时间</th>
                <th data-options="field:'ipAddr'" width="10%">IP</th>
            </tr>
            </thead>
        </table>
    </div>
</div>

<script>

    $(function(){

        $('#queryLogBtn').bind('click', function () {
            var module = $('#moduleName').combobox('getValue');
            var type = $('#operateType').combobox('getValue');
            var content = $('#content').textbox('getValue');
            var startD = $('#startDate').datebox('getValue');
            var endD = $('#endDate').datebox('getValue');

            if (startD!=null && startD!='') {
                var flag = (endD!=null && endD!='');
                if (!flag) {
                    showMsg('提示', '结束日期不可以为空');
                    return ;
                }
            }

            var log = $('#adminLogDg').datagrid('options').queryParams;
            log.module = module;
            log.type = type;
            log.content = content;
            log.start = startD;
            log.end = endD;
            $('#adminLogDg').datagrid({'pageNumber':1});
            $('#adminLogDg').datagrid('reload');
        });

    });


    function onSelected(date){
        $('#endDate').datebox('reset');
    }

    function dateFormatter(date){
        var y = date.getFullYear();
        var m = date.getMonth()+1;
        var d = date.getDate();
        return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
    }
</script>